package sixth.group.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sixth.group.dao.DishesMapper;
import sixth.group.domain.Dishes;
import sixth.group.service.DishesService;

@Service(value = "dishesService")
public class DishesServiceImpl implements DishesService {

    @Autowired
    private DishesMapper dishesMapper;

    @Override
    public boolean dishInsert(Dishes dishes) {
        Integer b = dishesMapper.insertSelective(dishes);
        if(b==1)
        {
            return true;
        }
        else {
            return false;
        }
    }

    @Override
    public Integer dishDelete(Integer did) {
        int i = dishesMapper.deleteByPrimaryKey(did);
        return i;
    }

    @Override
    public boolean dishUpdate(Dishes dishes) {
        int i = dishesMapper.updateByPrimaryKeySelective(dishes);
        if (i == 1) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public Dishes selectbydid(Integer did) {
        Dishes dishes = dishesMapper.selectByPrimaryKey(did);
        return dishes;
    }

}

